from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

# 打开浏览器，请求网址
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')

# 定位kw标签 --显示等待
# ('id','kw') ===By.ID,'kw'
# kw = WebDriverWait(driver,10).until(EC.presence_of_element_located(('id','kw')))
# kw = WebDriverWait(driver,10).until(EC.presence_of_element_located((By.ID,'kw')))

kw = driver.find_element(By.ID,'kw')

t1 =(By.ID,'kw')
l1 =[By.ID,'kw']
# By.ID,'kw'
kw1 = driver.find_element(*t1)
kw2 = driver.find_element(*l1)

print(kw1.get_attribute('outerHTML'))
print(kw2.get_attribute('outerHTML'))